<%-- 
    Document   : index
    Created on : Sep 30, 2010, 2:30:43 PM
    Author     : madhurt
--%>

<%@page import="com.gebogebo.URLEntry"%>
<%@page import="com.gebogebo.ds.URLEntryDAO"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%
            String shortKey = (String) request.getAttribute("token");
            String qs = (String) request.getAttribute("qs");

            URLEntryDAO dao = new URLEntryDAO();
            URLEntry entry = dao.getURLEntry(shortKey);
            System.out.println("Entry received for key " + shortKey + " is " + entry);
%>

<!-- 
Type : <%= request.getAttribute("type")%>
Token : <%= request.getAttribute("token")%>
QS : <%= request.getAttribute("qs")%>
Path Info : <%= request.getPathInfo()%>
QS : <%= request.getQueryString()%>
getContextPath : <%= request.getContextPath()%>
getServletPath : <%= request.getServletPath()%>
getRequestURL : <%= request.getRequestURL()%>
-->

<html height="100%" style="height:100%">
    <head>
        <link type="text/css" rel="stylesheet" href="gebogebo_url_shorten.css" />
        <title>Testing...</title>
    </head>

    <body border="0" style="border:0px; overflow:hidden; margin:0px; height:100%"  height="100%">

        <table width="100%" height="100%" border="0" margin="0" style="margin:0px; border:0px; padding:0px;" frame="below">
            <tr width="100%" height="10%" style="border-bottom: 1px; border-bottom-color: #000000; border-bottom-style: solid;">
                <td align="left" valign="bottom" height="10%" style="text-align: left; vertical-align: bottom; border-bottom: 1px solid #000000">
                    <div style="float: left; vertical-align: bottom;">
                        <p style="font-size: 10px">
                            This page is a landing page for URLs shortened via the <a href="/" target="_blank">GeboGebo service</a>.
                            <br/>
                            The original long URL for this short link is <a href="<%= entry.getLongUrl()%>"><%= entry.getLongUrl()%></a>
                            <br/>
                            This content is NOT a part of the original link. The actual content starts below this line.
                        </p>
                    </div>

                    <div style="float: right; padding: 5px; vertical-align: middle;">
                        <a href="<%=entry.getLongUrl()%>" target="_top" style="border: 0px;">
                            <img width="16px" height="16px" src="close_icon_gray.png" alt="X" style="border: 0px;" border="0px" />
                        </a>
                    </div>

                    <div style="float: right;">
                        <script type="text/javascript"><!--
                            google_ad_client = "pub-9569920773120984";
                            /* GeboGebo_ShortURL */
                            google_ad_slot = "6576530944";
                            google_ad_width = 468;
                            google_ad_height = 60;
                            //-->
                        </script>
                        <script type="text/javascript"
                                src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
                        </script>
                    </div>
                </td>
            </tr>
            <tr width="100%" height="90%">
                <td width="100%" height="90%">
                    <iframe name="contentFrame" id="contentFrame" height="100%" frameborder="0" width="100%" src="<%=entry.getLongUrl()%>" 
                            framespacing="0" framepadding="0" margin="0" style="margin:0px; border:0px; padding:0px;" 
                            onload="alert('hi'); alert(document.getElementsByName('contentFrame')); alert(document.getElementsByName('contentFrame')[0]); alert(document.getElementsByName('contentFrame')[0].document.title);" />
                </td>
            </tr>	
        </table>
    </body>
</html>